package com.slj.springcloud.service.impl;

import com.slj.springcloud.mapper.PayMapper;
import com.slj.springcloud.model.dto.PayDTO;
import com.slj.springcloud.model.entity.PayEntity;
import com.slj.springcloud.repository.PayRepository;
import com.slj.springcloud.service.PayService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PayServiceImpl implements PayService {
    @Autowired
    private PayRepository payRepository;
    @Autowired
    private PayMapper payMapper;

    @Override
    public List<PayDTO> findAll() {
        System.out.println(payRepository.findAll());
        return payRepository.findAll().stream().map(payMapper::entityToDTO).toList();
    }
}
